
// BrowserRouter = Router + createBrowserHistory
// HashRouter = Router + createHashHistory
import { Route, Router, Switch, Redirect } from "react-router-dom";
import Login from "./pages/Login";
import Layout from './pages/Layout'
import NotFound from "./pages/NotFound";
import history from "./utils/history";
// 配置路由规则
export default function App() {
  return (
    <Router history={history}>
      <div>
        <Switch>
          {/* 路由重定向 */}
          <Redirect exact from="/" to="/home"></Redirect>
          {/* 路由规则 */}
          <Route path="/login">
            <Login></Login>
          </Route>
          <Route path="/home">
            <Layout></Layout>
          </Route>
          <Route>
            <NotFound></NotFound>
          </Route>
        </Switch>
      </div>
    </Router>
  )
}